﻿using AnesSystem.Model;
using AnesSystem.Models;
using AnesSystem.Udp;
using AnesSystem.Util;
using AnesSystem.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace AnesSystem.Controls
{
    /// <summary>
    /// OperationNoticeCtrl.xaml 的交互逻辑
    /// </summary>
    public partial class OperationNoticeCtrl : FunctionAndTableCtrl
    {

        #region Variables

        #endregion

        #region Constructor
        public OperationNoticeCtrl()
        {
            InitializeComponent();
            this.DataContext = OperationNoticeCtrlViewModel.Instance;
            PageOrientation = System.Printing.PageOrientation.Landscape;
            this.Loaded += OperationNoticeCtrl_Loaded;
        }
        #endregion

        #region Properties


        #endregion

        #region 依赖属性


        #endregion

        #region Event


        #endregion

        #region PrivateMethods


        public List<PatientLinkModel> GetPatientLink()
        {
            return OperationNoticeCtrlViewModel.Instance.GetPatientLink();
        }

        #endregion

        #region Public/ProtectedMethods

        public void SendSchedueData()
        {
            UdpModel udpModel = new UdpModel();
            udpModel.UpdateDate = OperationNoticeCtrlViewModel.Instance.SelectDateTime.ToString();
            UdpMangager.Instance.SendUdpServerMsg(ServiceSign.PAIBANHUICHUAN, udpModel);
        }

        public override void PrintVisual()
        {
            p.PrintTicket.PageOrientation = PageOrientation;
            List<FrameworkElement> temp = new List<FrameworkElement>();
            foreach (var item in OperationNoticeCtrlViewModel.Instance.DisplayOprList)
            {
                temp.Add(item);
            }
            Print(temp,false);
            Refesh();
        }

        public override void Refesh()
        {
            OperationNoticeCtrlViewModel.Instance.UpdateDisplayOprList();
        }

        #endregion

        #region EventHandlers

        /// 导出为Excel
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ExportParameterBtn_Click(object sender, RoutedEventArgs e)
        {
            ExportToExcel exportToExcel = new ExportToExcel();
            //exportToExcel.ExportParameterDataGrid(_displayOprList);
        }

        private void OperationNoticeCtrl_Loaded(object sender, RoutedEventArgs e)
        {
            FunctionListHeaderCtrlViewModel.Instance.DisplayButton(true, FunctionListButton.打印, FunctionListButton.刷新, FunctionListButton.导出, FunctionListButton.提交);
        }
        #endregion


    }
}
